package ui.actionhandler;

import javax.swing.*;
import java.awt.*;
import java.awt.event.FocusAdapter;
import java.awt.event.FocusEvent;

/**
 * Created with IntelliJ IDEA.
 * User: Deshun
 * Date: 2/18/13
 * Time: 11:01 AM
 * To change this template use File | Settings | File Templates.
 */
public class RowFocusAdaptor extends FocusAdapter {


    @Override
    public void focusGained(FocusEvent e) {

        if ( e.getSource() instanceof JPanel ) {
            ( ( JPanel ) e.getSource() ).setBorder(BorderFactory.createLineBorder(Color.gray, 1));
        }
    }

    public void focusLossed(FocusEvent e) {
        if ( e.getSource() instanceof JPanel ) {
            ( ( JPanel ) e.getSource() ).setBorder(null);
        }
    }
}
